using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "HOGIADINH_GIAODAN", Schema="dbo")]
	[Table(Name = "[dbo].[HOGIADINH_GIAODAN]")]
	public partial class HOGIADINH_GIAODAN : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Guid _manhankhau;

		private System.Guid? _magiaodan;

		private System.Guid? _maquanhegiatoc;

		private System.Guid? _mahogiadinh;

		private System.DateTime? _thoigianbatdau;

		private System.DateTime? _thoigianketthuc;

		private System.Guid? _mahogiadinh_chuyendi;

		private System.Boolean? _dachuyendi;

		private QUANHEGIATOC _prt_quanhegiatoc;

		private GIAODAN _prt_giaodan;

		private HOGIADINH _prt_hogiadinh;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MANHANKHAU", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MANHANKHAU
		{
			get
			{
				return _manhankhau;
			}
			set
			{
				OnChanged(this, "MANHANKHAU");
				_manhankhau = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAODAN", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAODAN
		{
			get
			{
				return _magiaodan;
			}
			set
			{
				OnChanged(this, "MAGIAODAN");
				_magiaodan = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAQUANHEGIATOC", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAQUANHEGIATOC
		{
			get
			{
				return _maquanhegiatoc;
			}
			set
			{
				OnChanged(this, "MAQUANHEGIATOC");
				_maquanhegiatoc = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAHOGIADINH", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAHOGIADINH
		{
			get
			{
				return _mahogiadinh;
			}
			set
			{
				OnChanged(this, "MAHOGIADINH");
				_mahogiadinh = value;
			}
		}

		[ExtraColumn(DbType = "datetime", Length = 0, TypeName = "System.DateTime", Type = typeof(System.DateTime), CanBeNull = true)]
		[Column(Name = "THOIGIANBATDAU", DbType = "datetime", IsPrimaryKey = false, CanBeNull = true)]
		public System.DateTime? THOIGIANBATDAU
		{
			get
			{
				return _thoigianbatdau;
			}
			set
			{
				OnChanged(this, "THOIGIANBATDAU");
				_thoigianbatdau = value;
			}
		}

		[ExtraColumn(DbType = "datetime", Length = 0, TypeName = "System.DateTime", Type = typeof(System.DateTime), CanBeNull = true)]
		[Column(Name = "THOIGIANKETTHUC", DbType = "datetime", IsPrimaryKey = false, CanBeNull = true)]
		public System.DateTime? THOIGIANKETTHUC
		{
			get
			{
				return _thoigianketthuc;
			}
			set
			{
				OnChanged(this, "THOIGIANKETTHUC");
				_thoigianketthuc = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAHOGIADINH_CHUYENDI", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAHOGIADINH_CHUYENDI
		{
			get
			{
				return _mahogiadinh_chuyendi;
			}
			set
			{
				OnChanged(this, "MAHOGIADINH_CHUYENDI");
				_mahogiadinh_chuyendi = value;
			}
		}

		[ExtraColumn(DbType = "bit", Length = 0, TypeName = "System.Boolean", Type = typeof(System.Boolean), CanBeNull = true)]
		[Column(Name = "DACHUYENDI", DbType = "bit", IsPrimaryKey = false, CanBeNull = true)]
		public System.Boolean? DACHUYENDI
		{
			get
			{
				return _dachuyendi;
			}
			set
			{
				OnChanged(this, "DACHUYENDI");
				_dachuyendi = value;
			}
		}

		public QUANHEGIATOC PRT_QUANHEGIATOC
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_quanhegiatoc == default(QUANHEGIATOC)))
					InfoTech.Core.Data.Receiver.TypeObject<QUANHEGIATOC>.Select(this, "PRT_QUANHEGIATOC", new[] { new Vector<string, string>("MAQUANHEGIATOC", "MAQUANHEGIATOC"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_quanhegiatoc;
			}
			set
			{
				_prt_quanhegiatoc = value;
			}
		}

		public GIAODAN PRT_GIAODAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaodan == default(GIAODAN)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAODAN>.Select(this, "PRT_GIAODAN", new[] { new Vector<string, string>("MAGIAODAN", "MAGIAODAN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaodan;
			}
			set
			{
				_prt_giaodan = value;
			}
		}

		public HOGIADINH PRT_HOGIADINH
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_hogiadinh == default(HOGIADINH)))
					InfoTech.Core.Data.Receiver.TypeObject<HOGIADINH>.Select(this, "PRT_HOGIADINH", new[] { new Vector<string, string>("MAHOGIADINH", "MAHOGIADINH"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_hogiadinh;
			}
			set
			{
				_prt_hogiadinh = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(HOGIADINH_GIAODAN);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
